﻿<!--
  
   TechObjectSelectorWindow.xaml
  
   Copyright (c) 2007 Mike Strobel
  
   This source code is subject to the terms of the Microsoft Reciprocal License (Ms-RL).
   For details, see <http://www.opensource.org/licenses/ms-rl.html>.
  
   All other rights reserved.
  
  -->
<Window x:Class="Supremacy.Editor.TechObjectSelectorWindow"
        xmlns="http://schemas.microsoft.com/netfx/2007/xaml/presentation"
        xmlns:local="clr-namespace:Supremacy.Editor"
        xmlns:tech="clr-namespace:Supremacy.Tech;assembly=SupremacyCore"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Select Tech Object" 
        WindowStyle="ThreeDBorderWindow"
        ResizeMode="NoResize"
        WindowStartupLocation="CenterOwner"
        SizeToContent="WidthAndHeight"
        ShowInTaskbar="False">
  <Window.Resources>
    <Style TargetType="{x:Type ListViewItem}">
      <EventSetter Event="MouseDoubleClick"
                   Handler="Item_MouseDoubleClick"/>
    </Style>
    <Style x:Key="MultiSelectListViewItemContainerStyle"
           TargetType="{x:Type ListViewItem}">
      <Setter Property="Template">
        <Setter.Value>
          <ControlTemplate TargetType="{x:Type ListViewItem}">
            <CheckBox IsChecked="{Binding Path=(ListViewItem.IsSelected), Mode=TwoWay, RelativeSource={RelativeSource Mode=TemplatedParent}}">
              <ContentPresenter Content="{Binding Path=Key}"/>
            </CheckBox>
          </ControlTemplate>
        </Setter.Value>
      </Setter>
    </Style>
  </Window.Resources>
  <Grid>
    <DockPanel LastChildFill="True">
      <TextBox x:Name="FilterText"
               DockPanel.Dock="Top"
               Margin="3"
               TextChanged="FilterText_TextChanged"/>
      <StackPanel DockPanel.Dock="Bottom"
                  HorizontalAlignment="Center"
                  Orientation="Horizontal">
        <Button x:Name="SelectButton"
                Content="Select"
                IsDefault="True"
                Margin="3,3,3,3"
                Padding="12,2,12,2"/>
        <Button x:Name="CancelButton"
                Content="Cancel"
                IsCancel="True"
                Margin="3,3,3,3"
                Padding="12,2,12,2"/>
      </StackPanel>
      <ListView x:Name="ItemsList"
                Height="360"
                Width="240"
                DisplayMemberPath="Key"
                ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                TextSearch.TextPath="Key">
        <ListView.Style>
          <Style TargetType="{x:Type ListView}">
            <Style.Triggers>
              <Trigger Property="SelectionMode"
                       Value="Multiple">
                <Setter Property="ItemContainerStyle"
                        Value="{StaticResource MultiSelectListViewItemContainerStyle}"/>
              </Trigger>
            </Style.Triggers>
          </Style>
        </ListView.Style>
      </ListView>
    </DockPanel>
  </Grid>
</Window>
